<?
$total = $this->total;
$news = $this->news;
$dateFormat = 'Y-m-d';
?>

<div class="content-box">

    <div class="content-box-header">
        <h3>Статистика по новостям</h3>
        <ul class="content-box-tabs">
            <li><a class="default-tab" href="#tab1">Таблица</a></li>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
            <a href="/admin/statistic/news">Очистить фильтры</a>
            За промежуток времени:
            <form action="" method="post">
                <input type="text" name="dateStart" value="<?= $this->dateStart ?>" class="datepicker">-
                <input type="text" name="dateEnd" value="<?= $this->dateEnd ?>" class="datepicker">
                <input type="submit" value="Применить">
            </form>

            Всего: <?= $total ?>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>#</th>
                    <th>Заголовок</th>
                    <th>Дата публикации</th>
                    <th>Автор</th>
                    <th>Рубрика</th>
                    <th>Просмотров</th>
                    <th>Средняя оценка</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                <? foreach ($news as $article): ?>
                <tr>
                    <td><?= $article['id'] ?></td>
                    <td><?= $this->escape($article['title']); ?></td>
                    <td><?= $article['date']->format($dateFormat) ?></td>
                    <td><?= $this->escape($article['author']); ?></td>
                    <td><?= $this->escape($article['rubric']['name']); ?></td>
                    <td><?= $article['views'] ?></td>
                    <td><?= $article['mark'] ?></td>
                    <td><a href="<?= $this->url(array('id' => $article['id']), 'news_view') ?>">Просмотр</a></td>
                </tr>
                    <? endforeach; ?>
                </tbody>
            </table>
            <?= $this->partial('paginator/common.phtml', array('paginator' => $this->paginator)) ?>
        </div>
    </div>
</div>